<?php $title = 'Lập trình PHP - Học PHP Mysql online miễn phí - PHP Programing';
      $short_content = 'Hướng dẫn lập trình PHP từ cơ bản đến nâng cao, PHP Frameworks , jQuery , Plugin';
      $og_url = "http://".$_SERVER['SERVER_NAME'];
 ?>
<?php 
include ('inc/top.php');
include ("inc/slide.php");
include ("inc/ads-top.php");
// include ("inc/banner.php");
?>
    <div class="row">
        <?php
          include("lib/connection.php");
          require_once 'class/class_rewrite_link.php';
          $rewrite_link = new rewrite_link();
        ?>
        <div class="col-sm-9">
          <div class="col-sm-12" style="padding:0">
            <div class="alert alert-info" style="margin-top:8px; margin-bottom:5px;">
              <h3 style="margin:0px;" class="h3-animation"><span aria-hidden="true" class="glyphicon glyphicon-flash"></span>  Bài viết mới nhất</h3>
            </div>
          </div>
          <div class="col-sm-12" style="padding:0">
            <?php 
              $sql = "SELECT * FROM thread  ORDER BY inp_date DESC LIMIT 4";
              $query = mysqli_query($conn,$sql);
              while ($data = mysqli_fetch_array($query)):
                $thread_id = $data['thread_id'];
                $title = $data['title'];
                $title_op =  $rewrite_link->slug($data['title_op']);
                $domain = $_SERVER['SERVER_NAME'];
            ?>
               <div class="col-sm-2" style="min-height:200px;"><img class="img-responsive" alt="php thread" src="http://kungfuphp.com/kungfuphp/php-thread1.png"></div>
               <div class="col-sm-4" style="min-height:200px;">
                <h4><a href="http://<?php echo $domain ?>/<?php echo $title_op; ?>-<?php echo $thread_id; ?>.html" title="<?php echo $data["title"]; ?>"><?php echo $data["title"]; ?></a></h4>
                <p><?php echo $data["short_content"]; ?></p>
                <div align="right">
                  <em><?php echo $data["inp_user"];?></em>
                  <em>(<?php echo $data["inp_date"];?>)</em>
                </div>
              </div>
            <?php  
              endwhile;
            ?>
          </div>

          <div class="col-sm-12" style="padding:0">
            <div class="alert alert-success" style="margin-top:8px; margin-bottom:5px;">
              <h3 style="margin:0px;" class="h3-animation"><span aria-hidden="true" class="glyphicon glyphicon-star"></span>  Xem nhiều nhất</h3>
            </div>
          </div>
          <div class="col-sm-12" style="padding:0">
            <?php 
              $sql = "SELECT * FROM thread INNER JOIN threadcount ON thread.thread_id = threadcount.thread_id  ORDER BY count DESC LIMIT 4";
              $query = mysqli_query($conn,$sql);
              while ($data = mysqli_fetch_array($query)):
                $thread_id = $data['thread_id'];
                $title = $data['title'];
                $title_op =  $rewrite_link->slug($data['title_op']);
                $domain = $_SERVER['SERVER_NAME'];
            ?>
               <div class="col-sm-2" style="min-height:200px;"><img class="img-responsive" alt="kungfuphp thread" src="http://kungfuphp.com/kungfuphp/php-thread.png"></div>
               <div class="col-sm-4" style="min-height:200px;">
                <h4><a href="http://<?php echo $domain ?>/<?php echo $title_op; ?>-<?php echo $thread_id; ?>.html" title="<?php echo $data["title"]; ?>"><?php echo $data["title"]; ?></a></h4>
                <p><?php echo $data["short_content"]; ?></p>
                <div align="right">
                  <em><?php echo $data["inp_user"];?></em>
                  <em>(<?php echo $data["inp_date"];?>)</em>
                </div>
              </div>
            <?php  
              endwhile;
            ?>
          </div>

          <div class="col-sm-12" style="padding:0">
            <div class="alert alert-danger" style="margin-top:8px; margin-bottom:5px;">
              <h3 style="margin:0px;" class="h3-animation"><span aria-hidden="true" class="glyphicon glyphicon-comment"></span>  Blog tản mạn - lập trình - cuộc sống</h3>
            </div>
          </div>
          <div class="col-sm-12" style="padding:0">
            <?php 
              $sql = "SELECT * FROM thread WHERE cat_id=3 ORDER BY inp_date DESC LIMIT 16";
              $query = mysqli_query($conn,$sql);
              while ($data = mysqli_fetch_array($query)):
                $thread_id = $data['thread_id'];
                $title = $data['title'];
                $title_op =  $rewrite_link->slug($data['title_op']);
                $domain = $_SERVER['SERVER_NAME'];
            ?>
               <div class="col-sm-2" style="min-height:200px;"><img class="img-responsive" alt="kungfuphp thread" src="http://kungfuphp.com/kungfuphp/Icon_DelphiPHP.png"></div>
               <div class="col-sm-4" style="min-height:200px;">
                <h4><a href="http://<?php echo $domain ?>/<?php echo $title_op; ?>-<?php echo $thread_id; ?>.html" title="<?php echo $data["title"]; ?>"><?php echo $data["title"]; ?></a></h4>
                <p><?php echo $data["short_content"]; ?></p>
                <div align="right">
                  <em><?php echo $data["inp_user"];?></em>
                  <em>(<?php echo $data["inp_date"];?>)</em>
                </div>
              </div>
            <?php  
              endwhile;
            ?>
          </div>

          <div class="col-sm-12" style="padding:0">
            <div class="alert alert-success" style="margin-top:8px; margin-bottom:5px;">
              <h3 style="margin:0px;" class="h3-animation"><span aria-hidden="true" class="glyphicon glyphicon-tree-deciduous"></span>  Lập trình php cơ bản</h3>
            </div>
          </div>
          <div class="col-sm-12" style="padding:0">
            <?php 
              $sql = "SELECT * FROM thread WHERE cat_id=1 ORDER BY inp_date DESC LIMIT 8";
              $query = mysqli_query($conn,$sql);
              while ($data = mysqli_fetch_array($query)):
                $thread_id = $data['thread_id'];
                $title = $data['title'];
                $title_op =  $rewrite_link->slug($data['title_op']);
                $domain = $_SERVER['SERVER_NAME'];
            ?>
               <div class="col-sm-2" style="min-height:200px;"><img class="img-responsive" alt="kungfuphp thread" src="http://kungfuphp.com/kungfuphp/php-thread.png"></div>
               <div class="col-sm-4" style="min-height:200px;">
                <h4><a href="http://<?php echo $domain ?>/<?php echo $title_op; ?>-<?php echo $thread_id; ?>.html" title="<?php echo $data["title"]; ?>"><?php echo $data["title"]; ?></a></h4>
                <p><?php echo $data["short_content"]; ?></p>
                <div align="right">
                  <em><?php echo $data["inp_user"];?></em>
                  <em>(<?php echo $data["inp_date"];?>)</em>
                </div>
              </div>
            <?php  
              endwhile;
            ?>
          </div>

          <div class="col-sm-12" style="padding:0">
            <div class="alert alert-info" style="margin-top:8px; margin-bottom:5px;">
              <h3 style="margin:0px;" class="h3-animation"><span aria-hidden="true" class="glyphicon glyphicon-send"></span>  Lập trình php nâng cao</h3>
            </div>
          </div>
          <div class="col-sm-12" style="padding:0">
            <?php 
              $sql = "SELECT * FROM thread WHERE cat_id=2 ORDER BY inp_date DESC LIMIT 8";
              $query = mysqli_query($conn,$sql);
              while ($data = mysqli_fetch_array($query)):
                $thread_id = $data['thread_id'];
                $title = $data['title'];
                $title_op =  $rewrite_link->slug($data['title_op']);
                $domain = $_SERVER['SERVER_NAME'];
            ?>
               <div class="col-sm-2" style="min-height:200px;"><img class="img-responsive" alt="kungfuphp thread" src="http://kungfuphp.com/kungfuphp/php-thread.png"></div>
               <div class="col-sm-4" style="min-height:200px;">
                <h4><a href="http://<?php echo $domain ?>/<?php echo $title_op; ?>-<?php echo $thread_id; ?>.html" title="<?php echo $data["title"]; ?>"><?php echo $data["title"]; ?></a></h4>
                <p><?php echo $data["short_content"]; ?></p>
                <div align="right">
                  <em><?php echo $data["inp_user"];?></em>
                  <em>(<?php echo $data["inp_date"];?>)</em>
                </div>
              </div>
            <?php  
              endwhile;
            ?>
          </div>

          <div class="col-sm-12" style="padding:0">
            <div class="alert alert-danger" style="margin-top:8px; margin-bottom:5px;">
              <h3 style="margin:0px;" class="h3-animation"><span aria-hidden="true" class="glyphicon glyphicon-comment"></span>  Hướng dẫn SEO website từ A-Z</h3>
            </div>
          </div>
          <div class="col-sm-12" style="padding:0">
            <?php 
              $sql = "SELECT * FROM thread WHERE cat_id=4 ORDER BY inp_date DESC LIMIT 16";
              $query = mysqli_query($conn,$sql);
              while ($data = mysqli_fetch_array($query)):
                $thread_id = $data['thread_id'];
                $title = $data['title'];
                $title_op =  $rewrite_link->slug($data['title_op']);
                $domain = $_SERVER['SERVER_NAME'];
            ?>
               <div class="col-sm-2" style="min-height:200px;"><img class="img-responsive" alt="kungfuphp thread" src="http://kungfuphp.com/kungfuphp/Icon_DelphiPHP.png"></div>
               <div class="col-sm-4" style="min-height:200px;">
                <h4><a href="http://<?php echo $domain ?>/<?php echo $title_op; ?>-<?php echo $thread_id; ?>.html" title="<?php echo $data["title"]; ?>"><?php echo $data["title"]; ?></a></h4>
                <p><?php echo $data["short_content"]; ?></p>
                <div align="right">
                  <em><?php echo $data["inp_user"];?></em>
                  <em>(<?php echo $data["inp_date"];?>)</em>
                </div>
              </div>
            <?php  
              endwhile;
            ?>
          </div>
        </div>
		<?php include 'inc/sidebar.php';?>
      </div>
   <?php include 'inc/footer.php';?>
   </div>